﻿// <copyright file="SquareViewExtension.cs" company="Ecole Normale Supérieure">
// Released under GPLv2
// </copyright>
// <summary>Provide extension feature to SquareView.</summary>

namespace Sqwarea.Web.Extensions
{
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Globalization;
    using System.IO;
    using System.Linq;
    using System.Text;
    using Sqwarea.GameLogic;
    using Sqwarea.GameLogic.View;

    /// <summary>
    /// Provide features to SquareView.
    /// </summary>
    public static class SquareViewExtension
    {
        /// <summary>
        /// return the string representation of the SquareView class
        /// </summary>
        /// <param name="squareView">The game provider</param>
        /// <returns>the string representation of this square view</returns>
        public static string ToShortString(this SquareView squareView)
        {
            return squareView.Position.X
                + "," + squareView.Position.Y
                + "," + ((squareView.HasKing.HasValue && squareView.HasKing.Value) ? "1" : string.Empty) + "," 
                + squareView.Troops + "," 
                + squareView.KingId + ","
                + squareView.Nickname;
        }
    }
}
